@model object

@{
    var htmlAttributes = new RouteValueDictionary();
    if (ViewBag.@class != null)
    {
        htmlAttributes.Add("class", "form-control " + ViewBag.@class);
    }
    else
    {
        htmlAttributes.Add("class", "form-control");
    }
}

<div class="form-group">
    @Html.LabelFor(m => m, new { @class = "col-sm-2 control-label" })
    <div class="col-sm-8">
        @Html.Password(
            "",
            ViewData.TemplateInfo.FormattedModelValue,
            htmlAttributes)
        @Html.ValidationMessageFor(m => m, null)
    </div>
</div>